package sdk.weinxin.beans.massmessage;


import sdk.weinxin.beans.massmessage.preview.MusicPreview;
import sdk.weinxin.beans.massmessage.preview.Preview;
import sdk.weinxin.beans.message.Media;

public class MassMusicMessage extends MassMessage {

    private Media music;
    public MassMusicMessage() {
        super();
        this.setMsgType("music");
    }
    public MassMusicMessage(String mediaId) {
        super();
        music = new Media(mediaId);
        this.setMsgType("music");
    }

    public Media getMusic() {
        return music;
    }

    public void setMusic(Media music) {
        this.music = music;
    }

    @Override
    public Preview convert() {
        //转为 Preview，官方未说明该类型
        Preview preview = new MusicPreview(music.getMediaId());
        if (this.getToUser() != null && this.getToUser().size() > 0) {
            preview.setToUser(this.getToUser().iterator().next());
        }
        return preview;
    }

}
